package com.woniu.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.woniu.pojo.Order;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniu.vo.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author long
 * @since 2022-10-12
 */
public interface OrderMapper extends BaseMapper<Order> {

    IPage<OrderSeachReturnVo> selectPageByIdNumAndTime(@Param("page") IPage page, @Param("searchVo") OrderSearchVo searchVo);

    OrderSeachByIdReturnVo selectDetailsById(long orderId);

    List<String> selectOrderImages(long orderId);

    List<ChargeReturnVo> searchChargeRule(long roadId);

    @Select("SELECT o.* from t_order o left join t_car c on o.car_id = c.id WHERE o.status = #{status} and o.patrol_id = #{patrolId} and c.user_id = 0")
    List<OrderSeachByIdReturnVo> searchByStatus(long patrolId,String status);

    OrderUpdateReturnVo selectDetailsAndPhone(long orderId);
    @Select("select * from t_order where status = 0 and space_id = #{spaceId}")
    Order selectBySpaceId(Long spaceId);

}
